import { Component, OnInit } from '@angular/core';
import { NavController, NavParams } from '@ionic/angular';
import { Router, ActivatedRoute } from '@angular/router';
@Component({
  selector: 'app-detail',
  templateUrl: './detail.page.html',
  styleUrls: ['./detail.page.scss'],
})
export class DetailPage implements OnInit {

  index: any
  detaildata: any
  data: any
  constructor(private activeRoute: ActivatedRoute, private router: Router) {
    this.data = [
      {
        //https://item.jd.com/100000009811.html
        img: "https://img11.360buyimg.com/n1/jfs/t30559/226/751774559/268885/2f9f70b2/5bfd040bN44137661.jpg",
        name: "儿童白色舞蹈袜子",
        price: 30.99,
        score: 4.8,
        stars: 5,
        index: 0,
        comments: [
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swapfrqtj305k05kwei.jpg",
            name: "匿名用户",
            time: "12月4日",
            content: "颜色很正，过年很喜庆，一家三口穿起来很有爱。只是感觉他家成人码偏大。宝宝的码比较合适。只是领子那里偏小，脱起来着实费了一番功夫。",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcg036fj305k05kt8q.jpg",
            name: "匿名用户",
            time: "1月2日",
            content: "衣服已收到！质量很不错！图片很可爱，布料摸起来很舒服，穿上很合适，也不掉色和变形，这个价格值了！好评！",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcv8cflj305k05k74a.jpg",
            name: "匿名用户",
            time: "3月27日",
            content: "衣服已收到！质量很不错！图片好可爱的，布料摸起来很舒服，穿上很合适，也不掉色和变形，值得购买！",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg",
            name: "匿名用户",
            time: "4月27日",
            content: "很适合一家人穿，图案颜色都行",
          }
        ]
      },
      {
        // https://item.jd.com/11691215480.html
        img: "https://img10.360buyimg.com/n1/jfs/t1/24959/4/10179/143996/5c83e5b5E47bc80f6/26a26604a7c86186.jpg",
        name: "婴儿内衣套装纯棉春秋",
        price: 59.00,
        score: 4.9,
        stars: 5,
        index: 1,
        comments: [
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swdkykavj305k05kmx7.jpg",
            name: "匿名用户",
            time: "3月17日",
            content: "质量非常好，做活动的时候买的，更划算，厚款和薄款各买了一双",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd9l7zpj305k05kdfu.jpg",
            name: "匿名用户",
            time: "2月19日",
            content: "值得信赖，一次买了两条，相信自发热的毛绒裤。以后宝宝跳舞就不会冷了。",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg",
            name: "匿名用户",
            time: "4月3日",
            content: "手感很好，触摸光滑柔软，弹性也很好，不是特别厚，0°左右穿应该可以",
          },{
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1sweda941j305k05k3yj.jpg",
            name: "匿名用户",
            time: "4月1日",
            content: "质量不错，一次买了好多件，快递很快",
          },
        ]
      },
      {
        //https://item.jd.com/40526501607.html
        img: "https://img12.360buyimg.com/n1/jfs/t1/21176/7/3530/218667/5c288387Ec65f4011/4acd494ac585daa4.jpg",
        name: "2018新款潮亲子全家装",
        price: 208.00,
        score: 4.8,
        stars: 5,
        index: 2,
        comments: [
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swdkykavj305k05kmx7.jpg",
            name: "匿名用户",
            time: "3月17日",
            content: "值得信赖，一次买了两条，相信自发热的毛绒裤。以后宝宝跳舞就不会冷了。",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg",
            name: "匿名用户",
            time: "2月19日",
            content: "质量非常好，做活动的时候买的，更划算，厚款和薄款各买了一双",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd9l7zpj305k05kdfu.jpg",
            name: "匿名用户",
            time: "4月3日",
            content: "手感很好，触摸光滑柔软，弹性也很好，不是特别厚，0°左右穿应该可以",
          },{
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1sweda941j305k05k3yj.jpg",
            name: "匿名用户",
            time: "4月1日",
            content: "质量不错，一次买了好多件，快递很快",
          },
        ]
      },
      {
        // https://item.jd.com/21144823241.html
        img: "https://img11.360buyimg.com/n1/jfs/t16240/213/744372352/375324/628eb952/5a3cc850Nf9c4404a.jpg",
        name: "连帽休闲卫衣家庭装亲子",
        price: 198.00,
        score: 4.7,
        stars: 5,
        index: 3,
        comments: [
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swapfrqtj305k05kwei.jpg",
            name: "匿名用户",
            time: "12月4日",
            content: "颜色很正，过年很喜庆，一家三口穿起来很有爱。只是感觉他家成人码偏大。宝宝的码比较合适。只是领子那里偏小，脱起来着实费了一番功夫。",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcg036fj305k05kt8q.jpg",
            name: "匿名用户",
            time: "1月2日",
            content: "衣服已收到！质量很不错！图片很可爱，布料摸起来很舒服，穿上很合适，也不掉色和变形，这个价格值了！好评！",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcv8cflj305k05k74a.jpg",
            name: "匿名用户",
            time: "3月27日",
            content: "衣服已收到！质量很不错！图片好可爱的，布料摸起来很舒服，穿上很合适，也不掉色和变形，值得购买！",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg",
            name: "匿名用户",
            time: "4月27日",
            content: "很适合一家人穿，图案颜色都行",
          }
        ]
      },
      {
        // https://item.jd.com/19031093274.html
        img: "https://img14.360buyimg.com/n1/jfs/t10156/317/2460272034/419021/b64fdc1f/59f83451N1faaed3c.jpg",
        name: "2019新品潮母女装母子装",
        price: 58.00,
        score: 4.7,
        stars: 5,
        index: 4,
        comments: [
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swdkykavj305k05kmx7.jpg",
            name: "匿名用户",
            time: "3月17日",
            content: "质量非常好，做活动的时候买的，更划算，厚款和薄款各买了一双",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd9l7zpj305k05kdfu.jpg",
            name: "匿名用户",
            time: "2月19日",
            content: "值得信赖，一次买了两条，相信自发热的毛绒裤。以后宝宝跳舞就不会冷了。",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg",
            name: "匿名用户",
            time: "4月3日",
            content: "手感很好，触摸光滑柔软，弹性也很好，不是特别厚，0°左右穿应该可以",
          },{
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1sweda941j305k05k3yj.jpg",
            name: "匿名用户",
            time: "4月1日",
            content: "质量不错，一次买了好多件，快递很快",
          },
        ]
      },
      {
        // https://item.jd.com/30651952146.html#crumb-wrap
        img: "https://img11.360buyimg.com/n1/jfs/t1/23724/33/6280/169281/5c4ae04dEf1da8ba9/c4f4b3b48572e9cb.jpg",
        name: "童装女童套装加绒保暖",
        price: 99.00,
        score: 5.0,
        stars: 4,
        index: 5,
        comments: [
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swapfrqtj305k05kwei.jpg",
            name: "匿名用户",
            time: "12月4日",
            content: "颜色很正，过年很喜庆，一家三口穿起来很有爱。只是感觉他家成人码偏大。宝宝的码比较合适。只是领子那里偏小，脱起来着实费了一番功夫。",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcg036fj305k05kt8q.jpg",
            name: "匿名用户",
            time: "1月2日",
            content: "衣服已收到！质量很不错！图片很可爱，布料摸起来很舒服，穿上很合适，也不掉色和变形，这个价格值了！好评！",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcv8cflj305k05k74a.jpg",
            name: "匿名用户",
            time: "3月27日",
            content: "衣服已收到！质量很不错！图片好可爱的，布料摸起来很舒服，穿上很合适，也不掉色和变形，值得购买！",
          },
          {
            icon: "http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg",
            name: "匿名用户",
            time: "4月27日",
            content: "很适合一家人穿，图案颜色都行",
          }
        ]
      }
    ]
    this.activeRoute.queryParams.subscribe(params => {
      let index = params["index"];
      this.index = + index
      console.log(this.index)
      this.detaildata = this.data[this.index]
      console.log(this.detaildata)

    });
  }

  ngOnInit() {
    console.log("init")
  }

}

// 1  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swapfrqtj305k05kwei.jpg
// 2  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcg036fj305k05kt8q.jpg
// 3  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcv8cflj305k05k74a.jpg
// 4  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg
// 5  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd9l7zpj305k05kdfu.jpg
// 6  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swdkykavj305k05kmx7.jpg
// 7  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swe53ebhj305k05k0sr.jpg
// 8  http://ww1.sinaimg.cn/large/006M5LK3ly1g1sweda941j305k05k3yj.jpg